/* Vietnamese ERP Offline Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.tab {
    display: none;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
}


.tbviewdata {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
    .tbviewdata th {
        padding: 12px;
        background: var(--primary-blue);
        color: white;
        text-align: left;
        border-bottom: 2px solid #1e40af;
    }
.dataexit-1 {
    color: blue;
}
.btnsubmit {
    padding: 12px 24px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.popupview {
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
}
   

    #createorder {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1001;
        display: flex;
        justify-content: center;
        align-items: center;
    }
.dathanhtoan {
    color: #22c55e;
    font-weight: 600;
}
.congno {
    color: #ef4444;
    font-weight: 600;
}
.divctr {
    display: flex;
    gap: 8px;
    align-items: center;
}
.modal{
    overflow:auto!important
}
#product-list .custom-dropdown {
    width: 35%
}
.autoprouct, .proitem {
    width: 35%
}
.ui-autocomplete {
    z-index: 999999 !important;
}
.ipnumber{text-align:right}
.product-row-templeat {
    display: none
}
.product-row-select {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.inputtxt {
    padding: 8px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-weight: 600;
    color: #1e40af;
}
:root {
    --primary-blue: #2563eb;
    --primary-green: #059669;
    --primary-purple: #7c3aed;
    --accent-orange: #ea580c;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-gradient: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 50%, #ecfdf5 100%);
    --card-gradient: linear-gradient(145deg, #ffffff 0%, #fafbfc 100%);
    --header-gradient: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #06b6d4 100%);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: white;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-header {
    background: var(--header-gradient);
    padding: 24px;
    color: white;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.app-title {
    font-size: 22px;
    font-weight: bold;
    margin: 0;
}

.app-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.nav-menu {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

    .nav-section h3 {
        font-size: 14px;
        font-weight: 600;
        color: var(--text-secondary);
        margin-bottom: 12px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

.nav-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer !important;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
}

    .nav-item:hover {
        background: #f3f4f6;
        transform: translateX(4px);
    }

    .nav-item.active {
        background: var(--header-gradient);
        color: white;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    }

.nav-item-icon {
    margin-right: 12px;
    font-size: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
}

.header {
    background: white;
    padding: 20px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
}

.header-subtitle {
    color: var(--text-secondary);
    margin-top: 4px;
}

.demo-badge {
    background: var(--success-gradient);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.content {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-gradient);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

    .stat-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 16px 48px rgba(0,0,0,0.12);
    }

    .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
    }

    .stat-card.revenue::before {
        background: var(--success-gradient);
    }

    .stat-card.orders::before {
        background: var(--header-gradient);
    }

    .stat-card.customers::before {
        background: var(--warning-gradient);
    }

    .stat-card.products::before {
        background: var(--danger-gradient);
    }

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
 
}

.stat-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    font-size: 20px;
    opacity: 0.7;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);

}

.stat-change {
    font-size: 12px;
    font-weight: 600;
}

    .stat-change.positive {
        color: #059669;
    }

    .stat-change.negative {
        color: #dc2626;
    }

/* Quick Actions */
.quick-actions {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.action-button {
    background: var(--card-gradient);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

    .action-button:hover {
        border-color: var(--primary-blue);
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
    }

.action-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.action-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.action-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Recent Activity */
.recent-activity {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s ease;
}

    .activity-item:hover {
        background: #f9fafb;
    }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
}

    .activity-icon.success {
        background: rgba(16, 185, 129, 0.1);
        color: #059669;
    }

    .activity-icon.warning {
        background: rgba(245, 158, 11, 0.1);
        color: #d97706;
    }

    .activity-icon.info {
        background: rgba(37, 99, 235, 0.1);
        color: #2563eb;
    }

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 14px;
}

.activity-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.activity-time {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1002;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
}

/* Enhanced Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }

    .main-content {
        margin-left: 260px;
    }

    .action-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        z-index: 1002;
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .mobile-overlay.show {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        padding: 15px 20px;
        padding-left: 70px; /* Space for mobile menu button */
    }

    .header-title {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .action-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .action-button {
        padding: 12px 8px;
        font-size: 12px;
    }

    .action-icon {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .content {
        padding: 16px;
    }

    .demo-badge {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 30px 20px;
        margin: 20px;
    }

    .login-logo {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .login-title {
        font-size: 24px;
    }

    .header-title {
        font-size: 18px;
    }

    .stats-grid {
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .action-button {
        padding: 16px;
        flex-direction: row;
        text-align: left;
        gap: 12px;
    }

    .action-icon {
        margin-bottom: 0;
        font-size: 24px;
    }

    .content {
        padding: 12px;
    }

    .section-title {
        font-size: 16px;
    }
}


/* Modal Responsive */
@media (max-width: 768px) {
    div[style*="position: fixed"][style*="z-index"] div[style*="width: 500px"],
    div[style*="position: fixed"][style*="z-index"] div[style*="width: 700px"],
    div[style*="position: fixed"][style*="z-index"] div[style*="max-width: 90vw"] {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 20px !important;
        margin: 10px !important;
    }
}

@media (max-width: 480px) {
    div[style*="position: fixed"][style*="z-index"] div[style*="padding: 32px"] {
        padding: 16px !important;
    }

    div[style*="position: fixed"][style*="z-index"] h3 {
        font-size: 16px !important;
        margin-bottom: 16px !important;
    }

    div[style*="position: fixed"][style*="z-index"] input,
    div[style*="position: fixed"][style*="z-index"] select,
    div[style*="position: fixed"][style*="z-index"] textarea {
        padding: 10px !important;
        font-size: 14px !important;
    }

    div[style*="position: fixed"][style*="z-index"] button {
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Screen Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-gradient);
    z-index: 1000;
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    overflow: hidden;
}

    .login-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 5px;
        background: var(--header-gradient);
    }

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--header-gradient);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: white;
}

.login-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.login-form {
    margin-bottom: 20px;
}

    .login-form .form-group {
        margin-bottom: 20px;
    }

        .login-form .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .login-form .form-group input {
            width: 100%;
            padding: 15px;
            border: 2px solid #e5e7eb;
            border-radius: 10px;
            font-size: 16px;
            transition: all 0.3s ease;
        }

            .login-form .form-group input:focus {
                outline: none;
                border-color: var(--primary-blue);
                box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
            }

.login-button {
    width: 100%;
    padding: 15px;
    background: var(--header-gradient);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

    .login-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
    }

.login-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

    .login-info strong {
        color: var(--text-primary);
    }
#newctm {
    background: #00000059
}

.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}


/* Enhanced Form Responsive Design */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .form-group {
        margin-bottom: 15px !important;
    }

        .form-group label {
            font-size: 14px !important;
            margin-bottom: 6px !important;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            padding: 12px !important;
            font-size: 16px !important; /* Prevent zoom on iOS */
            border-radius: 8px !important;
        }

    .form-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }

        .form-buttons button {
            width: 100% !important;
            padding: 12px !important;
            font-size: 16px !important;
        }
}


/* Enhanced Modal Responsive */
@media (max-width: 768px) {
    .modal-backdrop {
        padding: 10px !important;
    }

    .modal-content {
        width: calc(100vw - 20px) !important;
        max-width: none !important;
        max-height: calc(100vh - 20px) !important;
        margin: 0 !important;
        border-radius: 12px !important;
    }

    .modal-header {
        padding: 16px 20px !important;
        flex-direction: column !important;
        gap: 8px !important;
        text-align: center !important;
    }

        .modal-header h3 {
            font-size: 18px !important;
            margin: 0 !important;
        }

    .modal-body {
        padding: 20px !important;
        max-height: calc(70vh) !important;
        overflow-y: auto !important;
    }

    .modal-footer {
        padding: 16px 20px !important;
        flex-direction: column-reverse !important;
        gap: 10px !important;
    }

        .modal-footer button {
            width: 100% !important;
            padding: 12px !important;
            font-size: 16px !important;
        }
}

/* Print styles */
@media print {
    .sidebar,
    .mobile-menu-toggle,
    .mobile-overlay,
    .header,
    .demo-badge,
    button:not(.print-button) {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content {
        padding: 0 !important;
        max-width: none !important;
    }

    body {
        background: white !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
    }

    .nav-item:hover {
        background: #333333 !important;
        color: #ffffff !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
